I have been pondering making a Threads "Stats" add on.
In it, I'd hoped to gather and DB referer URLs... as well as tracking page counts, and maybe even page views by user in the last x days.
Nearest I could figure.... and this is my concern, would be adding one query to every page view in threads. Similar to the who's online function.
My *theory* was this:
On each page view, the ubbt.inc.php file would record:
- referer info
- user agent info
- user number
- time stamp
Then to display some stats, you could do a couple of things:
- you could grab all the referers in a certain date period, with a select distinct statment (that aren't from your own site) and sort them to show top referers.
- You could do the same with user agent info.
- You could count the rows in a given date period, and thus know page views.
- You could count the rows by usernumber, and thus know that User X viewed y number of pages this month..... while user A only viewed Z number of pages this month.
Sounds pretty cool... in theory.
My questions/concerns for you guys to voice feedback...
- This would add 1 query per page, similar to the who's online function. Might not be a big deal.... but I'd like feedback on that.
- This would essentially add one row in a database table for every page view. On some sites that would make the table huge in a hurry. Will this slow things down, or would it be OK because you are just Inserting to the table on each view, and not searching into it.
To avoid the table getting too large, it could potentially dump all rows over (60,90,120?) days old automatically. Thus only allowing your stats to go back so far.
Any ideas/feedback on this.
Does it seem doable.
Maybe there is a better/smarter way to structure the table... I'm just thinking off the cuff.

I think I could pull it off, but my concern is database load/speed concerns.
